#!/bin/sh

######################################
#       Slackware Build Script       #
######################################
#  AUTHOR: Lehman Black              #
# CONTACT: bzqwerty[at]gmail[dot]com #
######################################

# Modified by the SlackBuilds.org project

PROG=uri-escape
VERSION=1.35
ARCH=noarch
TAG=${TAG:-_SBo}
BUILD=${BUILD:-1}

CWD=`pwd`
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PROG
OUTPUT=${OUTPUT:-/tmp}

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
chown -R root:root .
chmod a-s,u+w,go-w+r .

tar xvf $CWD/URI-$VERSION.tar.gz || exit 1
cd URI-$VERSION

perl Makefile.PL PREFIX=/usr || exit 1

make || exit 1
make install DESTDIR=$PKG || exit 1

mkdir -p $PKG/usr/doc/$PROG-$VERSION 
cp -a Changes README rfc2396.txt $PKG/usr/doc/$PROG-$VERSION
cat $CWD/$PROG.SlackBuild > $PKG/usr/doc/$PROG-$VERSION/$PROG.SlackBuild

# Remove the perllocal.pod file
rm -f $PKG/usr/lib/perl5/5.8.8/i486-linux/perllocal.pod

mv $PKG/usr/share/man $PKG/usr
gzip -9 $PKG/usr/man/man?/*
rm -rf $PKG/usr/share

mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc

cd $PKG
/sbin/makepkg -l y -c y $OUTPUT/$PROG-$VERSION-$ARCH-$BUILD$TAG.tgz
